package com.qf.java2105.huangchuang.hotel.dao;

import com.qf.java2105.huangchuang.hotel.pojo.Food;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 菜品持久层接口
 * @author hcvg
 * @version v1.0
 * @date 2021/09/12
 **/
public interface IFoodDao {
    /**
     * 通过菜品名查询
     * @param foodName
     * @return
     * @throws SQLException
     */
    List<Map<String, Object>> findByFoodName(String foodName) throws SQLException;

    /**
     * 添加一个菜品
     * @throws SQLException
     */
    void save(Food food) throws SQLException;

    /**
     * 通过id查询菜品
     * @param id
     * @return
     * @throws SQLException
     */
    Food findById(Integer id) throws SQLException;

    /**
     * 通过id删除菜品
     * @param id
     * @throws SQLException
     */
    void deleteById(Integer id) throws SQLException;

    /**
     * 更改菜品信息
     * @param food
     * @throws SQLException
     */
    void update(Food food) throws SQLException;

    /**
     * 查看菜品是否存在
     * @param foodName
     * @return
     * @throws SQLException
     */
    Integer foodNameExist(String foodName) throws SQLException;

    /**
     * 通用条件查询结果计数
     * @param typeId
     * @param foodName
     * @return
     * @throws SQLException
     */
    Long countByCondition(Integer typeId, String foodName) throws SQLException;

    /**
     * 通用分页查询
     * @param start
     * @param pageSize
     * @param typeId
     * @param foodName
     * @return
     * @throws SQLException
     */
    List<Food> findByPageWithCondition(Integer start, Integer pageSize, Integer typeId, String foodName) throws SQLException;
}
